﻿<phone:PhoneApplicationPage 
    x:Class="WPtrakt.ViewEpisode"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:custom="clr-namespace:WPtrakt.Custom"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    SupportedOrientations="PortraitOrLandscape"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False" BackKeyPress="PhoneApplicationPage_BackKeyPress" OrientationChanged="PhoneApplicationPage_OrientationChanged">
    <Grid x:Name="LayoutRoot">
        <ProgressBar VerticalAlignment="Top" HorizontalAlignment="Left" Width="400" Visibility="{Binding LoadingStatusEpisode}" Name="progressBarLoading" IsIndeterminate="True" />

        <controls:Panorama  Title="{Binding Name}" Name="EpisodePanorama" SelectionChanged="EpisodePanorama_SelectionChanged">
            <controls:PanoramaItem Header="Overview" Margin="0, -25">
                <Grid Margin="0 -30">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Name="loadingTextSuggest" Text="Loading.." HorizontalAlignment="Center" Visibility="{Binding LoadingStatusEpisode}"/>
                    <ListBox Margin="0, 0,0,-3" Visibility="{Binding DetailVisibility}" >
                        <ListBoxItem Height="Auto" >
                            <StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <custom:DelayLoadImage VerticalAlignment="Bottom" DefaultImageSource="Images/screen-small.jpg" ActualImageSource="{Binding ScreenImage}" Margin="15" Height="246" Width="436"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="Season:" FontSize="30" Style="{StaticResource PhoneTextLargeStyle}"  Foreground="Coral" />
                                    <TextBlock Text="{Binding Season}" FontSize="27" VerticalAlignment="Bottom" Style="{StaticResource PhoneTextLargeStyle}"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="Episode:" FontSize="30" Style="{StaticResource PhoneTextLargeStyle}"  Foreground="Coral" />
                                    <TextBlock Text="{Binding Number}" FontSize="27" VerticalAlignment="Bottom" Style="{StaticResource PhoneTextLargeStyle}"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="Date:" FontSize="30" Style="{StaticResource PhoneTextLargeStyle}"  Foreground="Coral" />
                                    <TextBlock Text="{Binding AirDate}" FontSize="27" VerticalAlignment="Bottom" Style="{StaticResource PhoneTextLargeStyle}"  />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="Rating:" FontSize="30" Style="{StaticResource PhoneTextLargeStyle}"  Foreground="Coral" />
                                    <TextBlock Text="{Binding RatingString}" FontSize="27" VerticalAlignment="Bottom" Style="{StaticResource PhoneTextLargeStyle}" TextWrapping="Wrap"  />
                                </StackPanel>
                                <TextBlock Margin="10" Text="{Binding Overview}" FontSize="27" VerticalAlignment="Bottom" Style="{StaticResource PhoneTextLargeStyle}" Height="Auto" TextWrapping="Wrap" />
                            </StackPanel>
                        </ListBoxItem>
                        <ListBoxItem>
                            <StackPanel Orientation="Horizontal" Height="150">
                                <TextBlock Text="IMDB" FontSize="30" Style="{StaticResource PhoneTextLargeStyle}" TextDecorations="Underline" Name="ImdbButton" Tap="ImdbButton_Tap" />
                                <TextBlock Text="TVDB" FontSize="30" Style="{StaticResource PhoneTextLargeStyle}" TextDecorations="Underline" Name="TvdbButton" Tap="TvdbButton_Tap" />
                            </StackPanel>
                        </ListBoxItem>
                    </ListBox>
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="Shouts" Margin="0, -25">
                <Grid>
                    <ListBox VerticalAlignment="Top" Margin="0,-30,15,0" ItemsSource="{Binding ShoutItems}" Name="ShoutList" Height="420" Width="405">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid  Margin="0,0,0,17" Height="Auto" VerticalAlignment="Stretch">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="60"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Grid.Column="1" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-60 12" Height="60"/>
                                    <StackPanel Grid.Column="2" Orientation="Vertical" Height="Auto">
                                        <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left"  Height="50"  Text="{Binding Name}" Style="{StaticResource PhoneTextLargeStyle}" />
                                        <TextBlock VerticalAlignment="Top"  HorizontalAlignment="Left" Height="Auto" TextWrapping="Wrap" Text="{Binding SubItemText}" Style="{StaticResource PhoneTextSubtleStyle}"  Name="ShoutText" MaxWidth="550" />
                                    </StackPanel>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <StackPanel VerticalAlignment="Bottom" Height="Auto" Margin="0,0,0,23" Name="ShoutSubmitText">
                        <TextBox  InputScope="Text" Name="ShoutText" VerticalAlignment="Bottom" />
                    </StackPanel>
                </Grid>
            </controls:PanoramaItem>
        </controls:Panorama>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar >
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized">
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>